package com.elitetyc.customview.activity;

import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.view.View;
import android.widget.ArrayAdapter;
import android.widget.ListView;

import com.elitetyc.customview.R;

public class ListCheckActivity extends AppCompatActivity {

    private ListView lv_checked;
    String[] data = new String[]{"极其化生","变形金刚","火影忍者","一条狗的使命","极其化生","变形金刚","火影忍者","一条狗的使命","极其化生","变形金刚","火影忍者","一条狗的使命",
            "极其化生","变形金刚","火影忍者","一条狗的使命","极其化生","变形金刚","火影忍者","一条狗的使命","极其化生","变形金刚","火影忍者","一条狗的使命","极其化生","变形金刚","火影忍者","一条狗的使命"};

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_list_check);
        lv_checked = findViewById(R.id.lv_checked);
    }

    public void btnSingle1(View view) {
        ArrayAdapter arrayAdapter = new ArrayAdapter(this,android.R.layout.simple_list_item_checked,data);
        lv_checked.setAdapter(arrayAdapter);
        lv_checked.setChoiceMode(ListView.CHOICE_MODE_SINGLE);

    }
    public void btnSingle2(View view) {
        ArrayAdapter arrayAdapter = new ArrayAdapter(this,android.R.layout.simple_list_item_single_choice,data);
        lv_checked.setAdapter(arrayAdapter);
        lv_checked.setChoiceMode(ListView.CHOICE_MODE_SINGLE);

    }
    public void btnSingle3(View view) {
        ArrayAdapter arrayAdapter = new ArrayAdapter(this,android.R.layout.simple_list_item_multiple_choice,data);
        lv_checked.setAdapter(arrayAdapter);
        lv_checked.setChoiceMode(ListView.CHOICE_MODE_MULTIPLE);

    }


}
